package com.example.mybatislearn.my;

import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

@Configuration
public class PageHelperConfig implements InitializingBean {
    @Autowired
    private SqlSessionFactory sqlSessionFactory;


    public void afterPropertiesSet() throws Exception {
        PageHelper interceptor = new PageHelper();
        interceptor.setProperties(null);
        sqlSessionFactory.getConfiguration().addInterceptor(interceptor);
    }
}
